import {
    createStore
} from 'vuex'
import constants from '../constants'

const store = createStore({
    state: {
        token: localStorage.getItem(constants.Token) || "",
        userInfo: localStorage.getItem(constants.UserInfo) ? JSON.parse(localStorage.getItem(constants.UserInfo)) : {}

    },
    mutations: {
        setToken(state, value) {
            state.token = value;
        },
        setUserInfo(state, value) {
            state.userInfo = value;
        },
    }
});

export default store;